Bézier Groove Cutting Calculator

Turning a Bézier curve on the side of your stock


This calculator produces a table of carriage and cross slide movements. With this table an operator can use a lathe equipped with the parting tool of choice to mimic a radius tool cutting an arbitrarily curved groove in the side of a part. The calculator will produce this table using the chosen step size for either roughing out a groove or for producing a groove that requires minimal filing.

There are three ways to find the desired Bézier curve, that I am aware of. I used a French curve stencil to find the cut for the Picture holders. This curve was held against the screen while dragging around the control points to get a good fit using the site, Bézier curve tutorial. A second way is to use the Grapher application. A saved Bézier curve graph, Documents/Bezier curve generator.gcx, can be modified by altering the four control points. The third way is using a saved file called Bezier Curves at Learn Maple. Again the control points have to modified to change the curve.

Need to log in to Learn Maple to use the web browser based math program and open the saved file. Login information is located in 1Password. Google Chrome is the preferred browser for this application. Safari is prohibitively slow.

The formulas used in Grapher calculation

The coefficients in the two equations use the default control points discussed below. The two central coefficients in each equation do not use the control points directly, but add factors. So 177 = 59 + 118, 429 = 143 + 286, 435 = 145 + 290, & 264 = 88 + 176. The same (red) factors need to be added to any control points used for the central coefficients.

The program needs four parameters to produce the table of cuts: the four control points of the cubic Bézier curve that is the profile of the desired groove (e.g., (57,220),(59,145),(143,88),(206,96)), the width of the cut, the depth of the cut, and the step size (e.g., 0.010). Both should be entered in decimal form. (Entering fractions will produce an error of some type, dependent on your browser.) The program assumes that the stock to be cut is more than twice the groove radius in diameter. (Or you will be mimicking a cutoff tool!) The default precision is three decimals, but this can be changed as desired. The next optional parameter that can be modified is the filing "buffer". It defaults to 0.003". Using the formulas precisely will take the corner of the cutter right up to the curve. Any movement past this point will result in cutting too deep. Since filing is required to remove the shoulders, a little extra can be built in via the buffer to avoid cutting too deep.

The picture shows a large and inconsistent filing buffer.

Sampling Density, the last optional parameter, is a quirk of the algorithm used. Instead of solving the two parametric equations for x and y, which is extremely complex, the function is sampled. The total range of the function is split into Sampling Density parts. The numbers generated for each of these points is used as a lookup table when looking for a depth of cut that corresponds to a given x‑coordinate. As an example, if the curve is to span one inch, then the default Sampling Density of 500 gives a depth of cut value every 0.002". This should be sufficient coverage for a 0.010" wide cut. If the width of cut drops or the size of the curve grows, 500 may not be sufficient and should be increased.

To use the chart the following procedure is recommended. Any long stretches of minimal cross slide advancement should all be cut at once in the standard fashion to save time. After this the carriage is moved one step to the right and the cross slide is advanced according to the value in the table. When the 'stepped' curve is complete file as needed to produce the 3‑dimensional Bézier curve of your dreams!

The x's and y's listed in the table may be of value for a lathe equipped with DROs on both axes.

The challenge faced when implementing this is finding y from x. Finding the roots of these cubic equations is non-trivial. Consequently, a different path will be used. A table of x values will be generated for a set number of t values in the range 0…1. A similar table of y values will be generated. A lookup algorithm will find the closest x‑value in the table and use the corresponding t‑value to find the associated y‑value in the y table.

This program only works for "simple" Bézier curves. That is, there is only one y‑value for each x‑value.

I found this code in DevonThink under array functions: findLastIndex. It returns the index of the last element for which the provided function returns a truthy value. It uses Array.prototype.map() to map each element to an array with its index and value. Use Array.prototype.filter() to remove elements for which the fxn returns falsy values, Array.prototype.pop() to get the last one. -1 is the default value when not found. It will be used for the look up function.

const findLastIndex = (arr, fn) =>
(arr
.map((val, i) = [i, val])
.filter(([i, val]) = fn(val, i, arr))
.pop() || [-1])[0];

Examples:

findLastIndex([1, 2, 3, 4], n => n % 2 === 1); // 2 (index of the value 3)
findLastIndex([1, 2, 3, 4], n => n === 5); // -1 (default value when not found)

It has been a struggle getting the code to work. I began thinking a simple conversion of the round curve cutting tool would be sufficient. Consequently, I did not think the problem through sufficiently. This morning I put some effort into planning the best approach to realizing this tool.

The following assumptions are critical for realizing this tool. You must start with a Bézier curve. The Bézier curve must be oriented as if it is on the part held in the lathe. There is a one-to-one correspondence between x- and y‑coordinates, e.g. the curve does not turn back toward its starting point. The output is formatted to assist cutting from the right end of the curve to the left. The maximum depth and width of the cut are known. The tool is not set up for face cuts, but the output could easily be adapted for a face cut.

The following steps are followed by the program.

  1. Using the four control points input by the user generate the array of x-coordinates and the array of y-coordinates
  2. Define ymax, ymin, xmax, and xmin
  3. Convert the curve's coordinate system to the lathe coordinate system.
  4. Scale the arrays to fit the dimensions of the part
  5. Starting at xmax find the depth of cut from the arrays, subtract the width of cut and repeat



Enter the required data for your planned Bézier curve cut:










Reload this HTML page between calculations, if you don't want successive calculations appended.